import request from '@/utils/request'
import API from './constants'

/**
 * 查询所有主分类的数据
 * @returns
 */
const getAllCategories = () => {
  return request.get(API.TABS_API)
}

/**
 * 根据主分类 id 查询子分类数据
 * @param {*} id
 */
const getSubCategories = id => request({
  url: API.TAB_API + '/' + id,
  method: 'GET',
}).then(data => data.categories)

// .......

export { getAllCategories, getSubCategories }
